﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using DingApi.Models;


using System.Web;
using Dingding.Helper;



namespace DingApi.Controllers
{
    public class BaoSightTestController : ApiController
    {


        public System.Data.DataSet GetAllBaoSightTest()
        {
            EI.EIInfo inBlock = new EI.EIInfo();
            inBlock.Tables[0].Columns.Add("WEIXIN_NO");

            inBlock.Tables[0].Rows.Add();
            inBlock.sys_info.company_code = "KS";
            inBlock.Tables[0].Rows[0]["WEIXIN_NO"] = "ooveSs7m1W053QqHY2myppykqcaY";


            EI.EIInfo outBlock = EI.EITuxedo.CallService("kssub1_inq_rp2", inBlock);






            //string sql_str0 = "select 235  value ,'视频广告' name from dual   ";
            //sql_str0 += "union all select 274  value ,'联盟广告' name from dual ";
            //sql_str0 += "union all select 310  value ,'邮件营销' name from dual ";
            //sql_str0 += "union all select 335  value ,'直接访问' name from dual ";
            //sql_str0 += "union all select 400  value ,'搜索引擎' name from dual ";


            string sql_str0 = "select 235  value ,'AB' name from dual   ";
            sql_str0 += "union all select 274  value ,'ED' name from dual ";
            sql_str0 += "union all select 310  value ,'XC' name from dual ";
            sql_str0 += "union all select 335  value ,'SG' name from dual ";
            sql_str0 += "union all select 400  value ,'GQ' name from dual ";


            outBlock = EF.Utility.ExecQuery(sql_str0);
            outBlock.Tables[0].TableName = "data_pie";

            outBlock.Tables[0].Columns[0].ColumnName = "value"; //饼图，好像必须为value 才行；
            outBlock.Tables[0].Columns[1].ColumnName = "name"; //饼图，好像必须为name 才行；

            
            return outBlock;    
        }
      

        public System.Data.DataSet PostAllBaoSightTest()
        {

            EI.EIInfo inBlock = new EI.EIInfo();
            inBlock.Tables[0].Columns.Add("WEIXIN_NO");
           
            inBlock.Tables[0].Rows.Add();
            inBlock.sys_info.company_code = "KS";
            inBlock.Tables[0].Rows[0]["WEIXIN_NO"] = "ooveSs7m1W053QqHY2myppykqcaY";

            
            EI.EIInfo outBlock = EI.EITuxedo.CallService("kssub1_inq_rp2", inBlock);
            //if (outBlock.sys_info.flag != 0)
            //{
            //    return outBlock;
            //}
            //if (outBlock.Tables[0].Rows.Count < 1)
            //{
            //    return outBlock;           
            //}

         

           string  sql_str0 = "select 235  value ,'视频广告' name from dual   ";
             sql_str0 += "union all select 274  value ,'联盟广告' name from dual ";
            sql_str0 += "union all select 310  value ,'邮件营销' name from dual ";
            sql_str0 += "union all select 335  value ,'直接访问' name from dual ";
            sql_str0 += "union all select 400  value ,'搜索引擎' name from dual ";

          
            outBlock = EF.Utility.ExecQuery(sql_str0);
            outBlock.Tables[0].TableName = "data_pie";

            return outBlock;  



            







           
        }
       
    }
}